# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=qt5-qtvirtualkeyboard
pkgver=5.15.5_git20220617
pkgrel=0
_commit="766c1b7acbdc9ff4e35f6eb341fd446b1c20b811"
pkgdesc="Virtual keyboard framework"
arch="all !armhf" # armhf blocked by qt5-qtdeclarative
url="https://www.qt.io/developers/"
license="LGPL-2.1-only AND LGPL-3.0-only AND GPL-3.0-only AND Qt-GPL-exception-1.0"
depends_dev="qt5-qtsvg-dev"
makedepends="$depends_dev
	hunspell-dev
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	"
subpackages="$pkgname-dev"
builddir="$srcdir/qtvirtualkeyboard-$_commit"

case $pkgver in
	*_beta*|*_rc*) _rel=development_releases;;
	*) _rel=official_releases;;
esac

source="https://invent.kde.org/qt/qt/qtvirtualkeyboard/-/archive/$_commit/qtvirtualkeyboard-$_commit.tar.gz"

prepare() {
	default_prepare

	# We need to make the build system think we're running in a git repository
	# so it correctly symlinks during the build
	mkdir .git
}

build() {
	qmake-qt5 CONFIG+="lang-all handwriting arrow-key-navigation"
	make
}

check() {
	make check
}

package() {
	make INSTALL_ROOT="$pkgdir" install

	# Drop QMAKE_PRL_BUILD_DIR because reference the build dir
	find "$pkgdir/usr/lib" -type f -name '*.prl' \
		-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;

	install -d "$pkgdir"/usr/share/licenses
	ln -s /usr/share/licenses/qt5-base "$pkgdir"/usr/share/licenses/$pkgname
}
sha512sums="
efece35a7b67451c2759f4d2611f14dde41d33d74b7b248a9b088bb12de05b7e032607833ca8fc71a2a6e96b30f849fc3d26f4b8d3cc6d7d4ca95eee0acc0d72  qtvirtualkeyboard-766c1b7acbdc9ff4e35f6eb341fd446b1c20b811.tar.gz
"
